/**
 * @fileOverview 事件对象
 * @author <a href="mailto:lexloo@126.com">lexloo</a>
 */
(function() {
	if (typeof $XEventObject != 'undefined') {
		return;
	}

	$Namespace('com.firefly');

	/**
	 * 事件对象
	 * 
	 * @class 事件对象
	 * @version 1.0
	 * @author <a href="mailto:lexloo@126.com">lexloo</a>
	 * @constructor
	 * @param {String}
	 *            name 事件名称,其后跟名称-值对
	 */
	com.firefly.XEventObject = function(name) {
		this.initialize(name);
	};

	/**
	 * @private
	 * 
	 * @param {String}
	 *            name 事件名称 其后跟名称-值对
	 */
	com.firefly.XEventObject.prototype.initialize = function(name) {
		this.name = name;
		this.properties = [];
		for ( var i = 1; i < arguments.length; i += 2) {
			if (arguments[i + 1]) {
				this.properties[arguments[i]] = arguments[i + 1];
			}
		}
		this.consumed = false;
	};

	/**
	 * 获取事件名称
	 * 
	 * @returns {String} 事件名称
	 */
	com.firefly.XEventObject.prototype.getName = function() {
		return this.name;
	};

	/**
	 * 获取属性
	 * 
	 * @returns {Array} 属性
	 */
	com.firefly.XEventObject.prototype.getProperties = function() {
		return this.properties;
	};

	/**
	 * 获取指定键值
	 * 
	 * @returns {Object} 指定键值
	 */
	com.firefly.XEventObject.prototype.getProperty = function(key) {
		return this.properties[key];
	};

	/**
	 * 是否已经消费
	 * 
	 * @return {Boolean} 消费与否
	 */
	com.firefly.XEventObject.prototype.isConsumed = function() {
		return this.consumed;
	};

	/**
	 * 消费事件
	 */
	com.firefly.XEventObject.prototype.consume = function() {
		this.consumed = true;
	};

	/**
	 * com.firefly.XEventObject的快捷访问
	 */
	$XEventObject = com.firefly.XEventObject;
})();